package com.cacho.s2b.lesson.grammar.func;

/**
 * @Description 接口实现入口
 * @Author LingWei
 * @date 2024/06/28
 **/

public class GrammarFuncGen {
    public static GrammarFunc getInstance(String name) {
        return switch (name.toLowerCase()) {
            // {{unique}}, {{unique(),16}}
            case "unique" -> new GrammarFuncUnique();
            // {{date}},{{date(yyyy-MM-dd'T'HH:mm,Asia/Riyadh,365)}}
            case "date" -> new GrammarFuncPastAndFutureDates();
            // 通过feature文件传参数
            case "jwt" -> new GrammarFuncJWT();
            case "jws" -> new GrammarFuncJWS();
            case "activation" -> new GrammarFuncActivationKey();
            case "env" -> new GrammarFuncEnv();
            case "empty" -> new GrammarFuncEmpty();
            case "format" -> new GrammarFuncFormat();
            default -> null;
        };
    }
}
